Skip to content

SLOP-394: require edit token for ?unreview= write (CSRF) in Special:PageStatistics - #10

Open
tosfos wants to merge 1 commit into
masterfrom
SLOP-394-csrf-unreview
Open

SLOP-394: require edit token for ?unreview= write (CSRF) in Special:PageStatistics#10
tosfos wants to merge 1 commit into
masterfrom
SLOP-394-csrf-unreview

Conversation

@tosfos

@tosfos tosfos commented Aug 23, 2026

Copy link
Copy Markdown

Summary

Special:PageStatistics?unreview=<timestamp> calls ReviewHandler::resetNotificationTimestamp(), which performs a raw UPDATE watchlist SET wl_notificationtimestamp = ... for the acting user — with no token check, triggered by a plain GET. Any page, link, or <img> tag can silently rewrite the victim's review timestamps. The timestamp value was also written to the DB completely unvalidated.

Fix:

  • SpecialPageStatistics::execute() requires the user's edit token (matchEditToken) before performing the unreview write, throwing PermissionsError('editmywatchlist') otherwise.
  • ReviewHandler::getTemplate() embeds the token in the right-click fallback URL so the normal UI path keeps working.
  • (Timestamp validation itself lands with the SLOP-379/381 port of resetNotificationTimestamp, since that method is being rewritten anyway.)

Verification

  • php -l clean on php:7.4-cli and php:8.2-cli for both files.
  • Harness: forged tokenless request → write performed (OLD) vs PermissionsError (NEW); tokened request → write succeeds; tokened request with malicious timestamp payload → rejected.

Closes SLOP-394.

Special:PageStatistics?unreview=<ts> rewrote the acting user\x27s
wl_notificationtimestamp on any GET with no token check, and wrote the
timestamp value unvalidated. Require the user\x27s edit token and embed
it in the ReviewHandler right-click fallback URL.
@coderabbitai

coderabbitai Bot commented Aug 23, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c830be61-9947-42ca-8bce-6d4398d7d228


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant